Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

docs($rootScope.Scope): reinsert lost example #12167

Closed
wants to merge 2 commits into from

Conversation

louisik1
Copy link

This doc example was lost long ago here 2845dd1

As it is now, it says 'here is a simple scope snippet...' but has a non-linking file link to the test doc. Doesn't make sense. This change simply puts back the example as it originally was.

This doc example was lost long ago here angular@2845dd1

As it is now, it says 'here is a simple scope snippet...' but has a non-linking file link to the test doc.  Doesn't make sense.  This change simply puts back the example as it originally was.
// still old value, since watches have not been called yet
expect(scope.greeting).toEqual(undefined);

scope.$digest(); // fire all the watches
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are at it, why not fix the double space after "all" :D

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Done.

removed extra white space at line 131 per code review suggestion
// still old value, since watches have not been called yet
expect(scope.greeting).toEqual(undefined);

scope.$digest(); // fire all the watches
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably change this to scope.$apply(), since the use of $digest is basically not recommened anywhere in the docs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't disagree regarding $digest not being recommended, but changing the example is not quite the scope of this request. This example was accidentally removed so I am just putting it back. This sample comes directly from the unit tests. All the examples on this page use $digest; none of them use $apply. The notes do indicate that $digest is not recommended, but similar notes regarding 'better practices' exist throughout the documentation. If you would like to file an issue to have the examples all changed to $apply, I think that would be great and hopefully someone can pick it up. Thanks!

@louisik1 louisik1 closed this Jul 9, 2015
@louisik1 louisik1 reopened this Jul 9, 2015
@Narretz Narretz closed this in 496e08a Aug 3, 2015
@Narretz
Copy link
Contributor

Narretz commented Aug 3, 2015

I decided to not add the example, because it introduces concepts like $watch and $digest without actually explaining them. The examples for the methods do a better job at this. I also added a link to the guide.

Narretz added a commit that referenced this pull request Aug 3, 2015
The removed line pointed to a removed example. Re-adding the example
would have been of questionable value, as it introduced several
concepts without context. It's therefore better to link to the guide,
which provides a better introduction.

Closes #12167
netman92 pushed a commit to netman92/angular.js that referenced this pull request Aug 8, 2015
The removed line pointed to a removed example. Re-adding the example
would have been of questionable value, as it introduced several
concepts without context. It's therefore better to link to the guide,
which provides a better introduction.

Closes angular#12167
ggershoni pushed a commit to ggershoni/angular.js that referenced this pull request Sep 29, 2015
The removed line pointed to a removed example. Re-adding the example
would have been of questionable value, as it introduced several
concepts without context. It's therefore better to link to the guide,
which provides a better introduction.

Closes angular#12167
ggershoni pushed a commit to ggershoni/angular.js that referenced this pull request Sep 29, 2015
The removed line pointed to a removed example. Re-adding the example
would have been of questionable value, as it introduced several
concepts without context. It's therefore better to link to the guide,
which provides a better introduction.

Closes angular#12167
@louisik1 louisik1 deleted the patch-1 branch April 18, 2016 23:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants